package com.example.method2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: springboot_course
 * @description:
 * @author: ChenZhiXiang
 * @create: 2019-08-06 20:18
 **/
@RestController
public class MethodTwo {

    @Autowired
    private Environment ev;

    @Autowired
    private DemoEntity demoEntity;

    @GetMapping("/b")
    public Object a(){
        Map<String,Object> map = new HashMap<>();
        map.put("a",ev.getProperty("czx.wt"));
        return map;
    }

    @GetMapping("/c")
    public Object c(){
        Map<String,Object> map = new HashMap<>();
        map.put("child1",demoEntity);
        map.put("child2",demoEntity.getChild2());
        return map;
    }

}
